<?
    require_once('./classes/config.inc.php');
    require_once('./classes/database.inc.php');
    $db = new LoggerDatabase();

    $date1 = date('Y-m-d');
    $date2 = $date1;

    $SelectSQL = 'SELECT `date` FROM `[PREF]lastvisit` WHERE `date`<\'' . mysql_escape_string($date1) . '\' LIMIT 0,1';
    $result = $db->Query($SelectSQL);
    if ($result && ($row = $db->FetchAssoc($result)))
        $date1 = $row['date'];

    header('Location: report.php?module=main&report=main&date1=' . $date1 . '&date2=' . $date2);
    exit;